package com.pcc.antimoney.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 76004
 * @apiNote
 * @date 2023/2/11 12:11
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = ServiceException.class)
    public Object handle(ServiceException e){
        Map<String,Object> map = new HashMap<>();
        map.put("code","success");
        map.put("msg",e.getMessage());
        return map;

    }

}
